<template>
  <div class="confirmIndex">
    <div class="archivesItem" v-for="item in table" :key="item.id" @click="lookDetailHandle(item.id)">
      <van-icon :name="item.icon" color="#000" size="50" />
      <p>{{ item.name }}</p>
    </div>
  </div>
</template>

<script>
export default {
  name: 'confirmIndex',
  data() {
    return {
      table: [],
    }
  },
  created(){
    this.initData();
  },
  methods: {
    initData(){
      var that = this
      var menus = JSON.parse(localStorage.getItem("userMenus"))
      menus.forEach(item =>{
         if(item.name=='门店查询'){
          var param = {
          id: '1',
          name: '我要查看门店档案',
          icon: 'newspaper-o',
        }
        that.table.push(param)
        }
        if(item.name=='商品查询'){
          var param = {
          id: '2',
          name: '我要查看商品档案',
          icon: 'description',
        }
        that.table.push(param)
        }
      });
      
    },
    lookDetailHandle(type) {
      this.$router.push({
        name: 'SearchIndex',
        query: {
          type,
        },
      })
    },
  },
}
</script>

<style lang="scss" scoped>
@import '../assets/styles/color.scss';
.confirmIndex {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 100px 0;
  width: 100vw;
  height: 100vh;
  background-color: $bg-color;
  > div {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 200px;
    height: 200px;
    border-radius: 20px;
    background-color: #fff;
    box-shadow: 0px 1px 2px 0 rgba($color: #000000, $alpha: 0.5);
    font-size: 16px;
    font-weight: 700;
    > p {
      margin-top: 30px;
    }
  }
}
</style>
